/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

import java.io.*;

/**
 *
 * @author Antoine Boulinguez et Shyn-Yuan Cheng
 */
public class FileFilter implements FilenameFilter {

    private String ext;

    public FileFilter(String ext) {
        this.ext = ext;
    }

    @Override
    public boolean accept(File dir, String name) {
        File f = new File(dir + "/" + name);

        if (f.isDirectory()) {
            return true;
        } else if (name.endsWith(ext)) {
            return true;
        } else {
            return false;
        }
    }
}
